<?php

namespace app\models;

use think\Db;
use think\Model;

class Message extends Model
{
    protected $pk = 'id';
    protected $autoWriteTimestamp = 'datetime';
    protected $createTime = 'created';
    protected $defaultSoftDelete = 0;

    public function getTypeTextAttr($value, $data)
    {
        $text = '';
        switch ($data['messtype']) {
            case '1':
                $data['type'] = empty($data['type']) ? 1 : $data['type'];
                $text = '下单问题';
                if ($data['type'] == 2) {
                    $text = '接单问题';
                }
                break;
            case '2':
                $text = '配送问题';
                break;
            case '3':
                $text = '其它问题';
                break;
            default:
                # code...
                break;
        }

        return $text;
    }
}
